<template>
  <div :class="prefixCls" v-if="info">
    <div class="px-3.5 py-1" :style="{ background: info.gbColor }">
      <a :style="{ color: info.color }" @click="go(info)">{{ info.label }}</a>
    </div>
  </div>
</template>

<script lang="ts" setup name="Link">
  // import { withDefaults, ref, onMounted } from 'vue';
  import { isUrl } from '/@/utils/is';
  import { useGo } from '/@/hooks/web/usePage';

  import { useDesign } from '/@/hooks/web/useDesign';
  // isUrl
  const { prefixCls } = useDesign('Link');
  defineProps<{
    info?: Recordable;
  }>();
  const goPage = useGo();

  const go = (data) => {
    const url = data.url;
    if (isUrl(url)) {
      window.location.href = url;
      return;
    }

    goPage(url);
  };
  // onMounted(() => {});
</script>
<style lang="less" scoped></style>
